package io;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class CopyDemo2 {
    public static void main(String[] args) throws Exception {
        FileInputStream fis = new FileInputStream("kobe.jpeg");
        FileOutputStream fos = new FileOutputStream("kobe_copy2.jpeg");
        long start = System.currentTimeMillis();
        int len;
        byte[] data = new byte[1024*10];
        while ((len = fis.read(data)) != -1) {
            fos.write(data,0,len);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕，耗时:"+(end-start)+"ms");
        fis.close();
        fos.close();
    }
}
